﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZFB.Models.EntityConfig
{
    public class IdNamesConfig :  IEntityTypeConfiguration<T_IdNames>
    {
        public void Configure(EntityTypeBuilder<T_IdNames> builder)
        {
            builder.ToTable("T_IdNames");
            
            builder.HasMany(e=>e.T_Houses).WithOne(e => e.T_IdNames).HasForeignKey(e => e.DecorateStatusId).OnDelete(DeleteBehavior.Restrict);
            
            builder.HasMany(e=>e.T_Houses1).WithOne(e => e.T_IdNames1).HasForeignKey(e => e.RoomTypeId).OnDelete(DeleteBehavior.Restrict);
            
            builder.HasMany(e => e.T_Houses2).WithOne(e => e.T_IdNames2).HasForeignKey(e => e.StatusId).OnDelete(DeleteBehavior.Restrict);
            
            builder.HasMany(e => e.T_Houses3).WithOne(e => e.T_IdNames3).HasForeignKey(e => e.TypeId).OnDelete(DeleteBehavior.Restrict);
        }
    }
}
